home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Line-Vector-routine v2.2
- ;
- ; done 1995 by Capella/Escape
- ; this routine is only for Escape-usage .... DON'T SPREAD!!!!
- ;
-
- ideal
- model large
- p386n
- stack 256
-
- assume cs:coding
-
- points = 6 ; Anzahl Punkte
- areas = 6 ; Anzahl Linien
- frames = 2 ; Anzahl Flächen
- ;-------------------------------------
- macro setcol backcol
-
- mov dx,03c8h
- xor al,al
- out dx,al
- inc dx
- mov al,backcol
- out dx,al
- out dx,al
- out dx,al
-
- endm
- ;-------------------------------
- macro setpage newpage
-
- mov dx,03d4h
- mov ax,newpage
- out dx,ax
-
- endm
- ;-------------------------------
-
- segment coding
-
- start: mov ax,data1
- mov ds,ax
- assume ds:data1
-
- mov ax,0a000h
- mov es,ax
- assume es:0a000h
-
- call set320400
- ; call set640400
-
- mov ax,0a800h
- mov es,ax
- assume es:0a800h
-
-
- main: call rotate_x
- call rotate_y
- call rotate_z
-
- call transform
-
- mov [ds:color],1 ; Objekt auf Seite 2 darstellen
- mov di,offset _2dpoints
- ; call draw_obj
-
- call sort_frames
-
- call fill_obj
-
-
-
- setpage 800ch ; Seite 2 an
-
- mov dx,03dah
- wb1: in al,dx
- test al,8
- jne wb1
- wb2: in al,dx
- test al,8
- je wb2
-
- mov ax,0a000h
- mov es,ax
- assume es:0a000h
-
- mov dx,03c4h
- mov ax,0f02h
- out dx,ax
-
- mov cx,32000/4 ; Objekt auf Seite 1 löschen
- xor si,si
- xor eax,eax
- del_p1: mov [es:si],eax
- add si,4
- dec cx
- jnz del_p1
-
-
-
- call get_oldpos ; Positionen von Seite 2 retten
-
-
-
- ;add [ds:xw],2
- ; add [ds:yw],2
- ; add [ds:zw],2
-
- call rotate_x
- call rotate_y
- call rotate_z
-
- call transform
-
- mov [ds:color],1 ; Objekt auf Seite 1 darstellen
- mov di,offset _2dpoints
- ; call draw_obj
- call fill_obj
-
- setpage 000ch ; Seite 1 an
-
- mov dx,03dah
- wb3: in al,dx
-
- test al,8
- jne wb3
- wb4: in al,dx
- test al,8
- je wb4
-
- mov ax,0a800h
- mov es,ax
- assume es:0a800h
-
- mov dx,03c4h
- mov ax,0f02h
- out dx,ax
-
- mov cx,32000/4
- xor si,si
- xor eax,eax
- del_p2: mov [es:si],eax
- add si,4
- dec cx
- jnz del_p2
-
- call get_oldpos ; Positionen von Seite 1 retten
-
- add [ds:xw],2 ; Neue Winkel berechnen
- add [ds:yw],4
- add [ds:zw],2
-
- warte: in al,60h ; Auf 'ESCAPE'-Taste warten
- cmp al,01
- jne main
-
-
- exit: mov ax,0003h
- int 10h
- mov ax,4c00h
- int 21h
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ; ROTATIONS-ROUTINE / dreht die 3d-koordinaten in x,y und z-richtung
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
- proc rotate_x NEAR
-
- mov si,offset xpos
- mov di,offset _3dpoints
- mov cx,points
-
- rotx_it:
- push cx
-
- mov ax,[ds:zw]
- call cosinus
- imul [word ds:si]
- mov cx,dx
- mov ax,[ds:zw]
- call sinus
- imul [word ds:si+2*points]
- sub dx,cx
- sal dx,1
- sal dx,1
- mov [ds:di],dx
-
- mov ax,[ds:zw]
- call sinus
- imul [word ds:si]
- mov cx,dx
- mov ax,[ds:zw]
- call cosinus
- imul [word ds:si+2*points]
- add dx,cx
- sal dx,1
- sal dx,1
- mov [ds:di+2*points],dx
-
- pop cx
- add si,2
- add di,2
- dec cx
- jnz rotx_it
- ret
-
- endp rotate_x
-
- proc rotate_y NEAR
-
- mov cx,points
- mov si,offset xpos
- mov di,offset _3dpoints
-
- roty_it:
- push cx
-
- mov ax,[ds:yw]
- call cosinus
- imul [word ds:si]
- mov cx,dx
- mov ax,[ds:yw]
- call sinus
- imul [word ds:si+4*points]
- sub dx,cx
- sal dx,1
- sal dx,1
- mov [ds:di],dx
-
- mov ax,[ds:yw]
- call sinus
- imul [word ds:si]
- mov cx,dx
- mov ax,[ds:yw]
- call cosinus
- imul [word ds:si+4*points]
- add dx,cx
- sal dx,1
- sal dx,1
- mov [ds:di+4*points],dx
-
- pop cx
- add si,2
- add di,2
- dec cx
- jnz roty_it
- ret
-
- endp rotate_y
-
- proc rotate_z NEAR
-
- mov cx,points
- mov si,offset xpos
- mov di,offset _3dpoints
-
- rotz_it:
-
- push cx
-
- mov ax,[ds:xw]
- call cosinus
- imul [word ds:si+2*points]
- mov cx,dx
- mov ax,[ds:xw]
- call sinus
- imul [word ds:si+4*points]
- sub dx,cx
- sal dx,1
- sal dx,1
- mov [ds:di+2*points],dx
-
- mov ax,[ds:xw]
- call sinus
- imul [word ds:si+2*points]
- mov cx,dx
- mov ax,[ds:xw]
- call cosinus
- imul [word ds:si+4*points]
- add dx,cx
- sal dx,1
- sal dx,1
- mov [ds:di+4*points],dx
-
- pop cx
- add si,2
- add di,2
- dec cx
- jnz rotz_it
- ret
-
- endp rotate_z
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ; TRANSFORMATION-ROUTINE / rechnet die 3d-koord. in 2d koord. um
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
- proc transform NEAR
-
- mov cx,points
- mov di,offset _2dpoints
- mov si,offset _3dpoints
-
- trans_it:mov bx,[ds:si+4*points]
- sub bx,[ds:dist]
-
- mov ax,[ds:dist]
- imul [word ds:si]
- idiv bx
- sar ax,1
- sar ax,1
- sar ax,1
- sar ax,1
- add ax,[ds:x_add]
- mov [ds:di],ax
-
- mov ax,[ds:dist]
- imul [word ds:si+2*points]
- idiv bx
- sar ax,1
- sar ax,1
- sar ax,1
- sar ax,1
- add ax,[ds:y_add]
- mov [ds:di+2*points],ax
-
- add si,2
- add di,2
- dec cx
- jnz trans_it
- ret
-
- endp transform
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ; COSINUS-ROUTINE
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
- proc cosinus NEAR
-
- add ax,64
-
- push bx
- push cx
- push si
-
- mov bx,ax
- shl ax,1
- and ax,0ffh
- mov si,offset sinustable
- add si,ax
- mov ax,[ds:si]
- clc
- shl bl,1
- jae cos_pos
- neg ax
- cos_pos:
- pop si
- pop cx
- pop bx
- ret
-
- endp cosinus
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ; SINUS-ROUTINE
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
- proc sinus NEAR
-
- push bx
- push cx
- push si
-
- mov bx,ax
- shl ax,1
- and ax,0ffh
- mov si,offset sinustable
- add si,ax
- mov ax,[ds:si]
- clc
- shl bl,1
- jae sin_pos
- neg ax
- sin_pos:
- pop si
- pop cx
- pop bx
- ret
-
- endp sinus
-
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
- ; DRAWLINE-ROUTINE / zieht eine linie von x1,y1 nach x2,y2 mit farbe col
- ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
-
- proc drawline NEAR
-
-
- draw_it:
-
- push bp
- mov ax,[ds:x1]
- mov bx,[ds:y1]
- push ax
- push bx
- mov bx,4340h
- mov cx,[ds:x2]
- sub cx,ax
- jge deltax_1
- mov bl,48h
- neg cx
-
- deltax_1:
-
- mov dx,[ds:y2]
- pop si
- push si
- sub dx,si
- jge deltay_1
- mov bh,4bh
- neg dx
-
- deltay_1:
-
- mov si,offset line_add
- mov [word cs:si],bx
- cmp cx,dx
- jge deltax_2
- mov bl,90h
- xchg cx,dx
- jmp achse3
-
- deltax_2:
-
- mov bh,90h
-
- achse3:
-
- mov si,offset line_sub
- mov [word cs:si],bx
- shl dx,1
- mov bp,dx
- sub dx,cx
- mov di,dx
- sub dx,cx
- pop bx
- pop ax
-
- line_loop:
-
- push di
- push ax
- push dx
- push bx
- push cx
-
- push ax
- mov ax,80
- imul bx
- pop cx
- mov bx,cx
- shr bx,1
- shr bx,1
- add ax,bx
- mov si,ax
-
- and cl,3
- mov ah,1
- shl ah,cl
- mov dx,03c4h
- mov al,02h
- out dx,ax
-
- mov al,[ds:color]
- inc [ds:color]
- mov [es:si],al
-
-
-
- pop cx
- pop bx
- pop dx
- pop ax
- pop di
- cmp di,0
- jge line_add
-
- line_sub:
-
- inc ax
- inc bx
- add di,bp
- loop line_loop
- jmp end_line
-
- line_add:
-
- inc ax
- inc bx
- add di,dx
- loop line_loop
-
- end_line:
-
- pop bp
-
- stop_line:
-
- ret
-
- endp drawline
-
-
-
- proc get_oldpos NEAR
-
- mov cx,2*points
-
- mov si,offset _2dpoints
- mov di,offset old2d
-
- old_loop:mov ax,[ds:si]
- mov [ds:di],ax
- add si,2
- add di,2
- dec cx
- jnz old_loop
-
- ret
-
- endp get_oldpos
-
- ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- ; FÜLLROUTINE V1.0
- ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- fill_obj : mov cx,frames
- mov si,offset xframe
- mov di,offset _2dpoints
-
- fill_obj1: mov bl,[ds:si]
- xor bh,bh
- shl bx,1
-
- mov ax,[ds:di+bx] ;get 1st point of frame
- mov [ds:t_x1],ax
- mov ax,[ds:di+2*points+bx]
- mov [ds:t_y1],ax
-
- inc si
-
- mov bl,[ds:si]
- xor bh,bh
- shl bx,1
-
- mov ax,[ds:di+bx]
- mov [ds:t_x2],ax
- mov ax,[ds:di+2*points+bx]
- mov [ds:t_y2],ax
-
- inc si
-
- mov bl,[ds:si]
- xor bh,bh
- shl bx,1
-
- mov ax,[ds:di+bx]
- mov [ds:t_x3],ax
- mov ax,[ds:di+2*points+bx]
- mov [ds:t_y3],ax
-
- inc si
-
- mov al,[ds:si]
- mov [ds:color],al
-
- inc si
-
- push cx
- push si
- push di
-
- call draw_polygon
-
- pop di
- pop si
- pop cx
-
- no_fill: dec cx
- jnz fill_obj1
-
- ret
-
- ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- ; SET 320*400 Graphics-mode (based on 4 bitplane-splitting)
- ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- proc set320400 NEAR
-
- mov ax,0013h
- int 10h
-
- mov dx,03c4h
- mov al,04h
- out dx,al
- inc dx
- in al,dx
- and al,11110111b
- out dx,al
- dec dx
-
- mov ax,0f02h
- out dx,ax
-
- mov dx,03d4h
- mov al,14h
- out dx,al
- inc dx
- in al,dx
- and al,10111111b
- out dx,al
- dec dx
- mov al,17h
- out dx,al
- inc dx
- in al,dx
- or al,01000000b
- out dx,al
-
- mov dx,03d4h
- mov al,09h
- out dx,al
- inc dx
- in al,dx
- and al,01110000b
- out dx,al
-
- mov dx,03c4h
- mov ax,0f02h
- out dx,ax
-
- mov ax,0a000h
- mov es,ax
- assume es:0a000h
-
- mov cx,64000 ; alle bitplanes auf beiden grafikseiten
- xor di,di ; löschen...
- xor eax,eax
- cld
- rep stosd
-
- ret
-
- endp set320400
-
- proc set640400 NEAR
-
- mov ax,000eh
- int 10h
-
- mov dx,03d4h
- mov al,09h
- out dx,al
- inc dx
- in al,dx
- and al,01111111b
- out dx,al
-
- ret
-
- endp set640400
-
- ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- ; DRAWS A FILLED POLYGON WITH 3 POINTS
- ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
-
- draw_polygon: mov ax,[ds:t_y1] ; vergleiche punkt1 mit punkt 2
- cmp ax,[ds:t_y2] ; Y von punkt1 kleiner Y von punkt2 ?
- jbe s_ok_1 ; ja, dann weiter
-
- xchg ax,[ds:t_y2] ; ansonsten X/Y von punkt1 mit X/Y von
- mov [ds:t_y1],ax ; punkt2 tauschen
- mov ax,[ds:t_x1]
- xchg ax,[ds:t_x2]
- mov [ds:t_x1],ax
-
- s_ok_1: mov ax,[ds:t_y2] ; vergleiche punkt2 mit punkt3
- cmp ax,[ds:t_y3] ; Y von punkt2 kleiner Y von punkt3 ?
- jbe s_ok_3 ; ja, dann weiter
-
- xchg ax,[ds:t_y3] ; ansonsten X/Y von punkt2 mit X/Y von
- mov [ds:t_y2],ax ; punkt3 tauschen
- mov ax,[ds:t_x3]
- xchg ax,[ds:t_x2]
- mov [ds:t_x3],ax
-
- s_ok_2: mov ax,[ds:t_y1] ; nochmals punkt1 mit neuem punkt2
- cmp ax,[ds:t_y2] ; vergleichen, da wir ja mit punkt3
- jbe s_ok_3 ; getauscht haben
-
- xchg ax,[ds:t_y2]
- mov [ds:t_y1],ax
- mov ax,[ds:t_x1]
- xchg ax,[ds:t_x2]
- mov [ds:t_x1],ax
-
- s_ok_3: mov bp,[ds:t_y3] ; die längste seitenlinie (punkt1-punkt3)
- mov dx,[ds:t_x3] ; berechnen
- mov ax,[ds:t_y1]
- mov bx,[ds:t_x1]
- mov di,offset buffer
-
- call calc_line
-
- mov bp,[ds:t_y2] ; nächste seitenlinie berechnen
- mov dx,[ds:t_x2] ; von punkt1 nach punkt2
- mov ax,[ds:t_y1]
- mov bx,[ds:t_x1]
- mov di,offset buffer+2
-
- call calc_line
-
- mov bp,[ds:t_y3] ; und letzte seitenlinie weiter berechnen
- mov dx,[ds:t_x3] ; von punkt2 nach punkt3
- mov ax,[ds:t_y2]
- mov bx,[ds:t_x2]
-
- call calc_line
- ; die seitenlinie von punkt1 nach punkt3
- ; hat ebensoviele positionen wie die
- ; seitenlinien von punkt1 nach punkt2 und
- ; punkt2 nach punkt3 zusammen.
- ; was auch nötig ist um später in dieser
- ; routine horizontale linien vom punkt einer
- ; seitenlinie zur nächsten zu ziehen
-
- mov bx,01h
-
- mov bp,[ds:t_y3]
- sub bp,[ds:t_y1]
- inc bp
-
- mov si,offset buffer
-
- mov al,bl
-
- imul dx,[ds:t_y1],ssizex/4
-
- draw_nline: mov di,[si]
- mov bx,[si+2]
- sub bx,di
- jnc width_pos
-
- add di,bx
- neg bx
-
- width_pos: inc bx
-
- push ax
- push dx
- call draw_line
- pop dx
- pop ax
-
- add si,4
- add dx,ssizex/4
- dec bp
- jnz draw_nline
-
- end_fill: ret
-
-
-
- calc_line: xor cx,cx ; CX auf null, wird zur berechnung der
- ; Steigung benötigt
-
- sub bp,ax ; differenz von Y-route berechnen
- inc bp ; +1
-
- sub dx,bx ; differenz von X-route berechnen
- jnc dx_not_neg ; wenn X-richtung positiv dann weiter
-
- mov cx,2 ; ansonsten CX mit 2 laden und DX negieren
- neg dx
-
- dx_not_neg: inc dx ; +1
- mov ax,bx ; X-beginn in AX laden
-
- mov bx,1 ; steigungsfaktor berechnen ob positiv oder
- sub bx,cx ; negativ (-1/+1)
-
- mov cx,bp ; counter mit Y-differenz laden
-
- cmp dx,bp ; vergleiche ob Y-differenz größer X-differenz
- jbe y_major ; ja, dann weiter
-
- mov cx,dx ; ansonsten counter mit X-differenz laden
- xchg bp,dx ; Y-differenz mit X-differenz tauschen
-
- mov si,bp ; SI mit X-differenz laden
-
- y_next_pixel: sub si,dx ; Dump = Dump - dy
- jnc y_positive
-
- add si,bp ; Dump = Dump + dx
-
- mov [ds:di],ax
- add di,4
-
- y_positive: add ax,bx ; Add increment
- dec cx
- jnz y_next_pixel
-
- sub ax,bx
- mov [ds:di],ax
- add di,4
-
- jmp end_filled_triangle
-
-
-
- y_major: mov si,bp
-
- x_next_pixel: mov [ds:di],ax
- add di,4
-
- sub si,dx ; Dump = Dump - dy
- jnc x_positive
-
- add ax,bx ; Add increment
- add si,bp ; Dump = Dump + dx
-
- x_positive: dec cx
- jnz x_next_pixel
-
- end_filled_triangle: ret
-
-
-
- draw_line: mov cx,di
- shr di,2
- add di,dx
-
- and cx,3
- add bx,cx
-
- mov ch,[ds:color]
- inc [ds:color]
-
- mov ax,0f02h
- shl ah,cl
- mov dx,03c4h
- sub bx,4
- jg not_same_nibble
-
- neg bl
- mov cl,bl
- mov bh,0fh
- shr bh,cl
- and ah,bh
- out dx,ax
-
- mov [es:di],ch
- ret
-
-
- not_same_nibble:out dx,ax
- mov [es:di],ch
- inc di
-
- cmp bx,3
- jle skip_rep
-
- mov ax,0f02h
- out dx,ax
- mov al,ch
- mov cx,bx
- shr cx,2
-
- rep stosb
-
- mov ch,al
- inc ch
- skip_rep: and bx,3
- jz no_last_byte
-
- mov cl,bl
- mov ax,0f002h
- rol ah,cl
- out dx,ax
-
- mov [es:di],ch
-
- no_last_byte: ret
-
-
-
- sort_frames: mov cx,frames
-
- mov si,offset frame
- mov di,offset z_positions
- mov bp,offset _3dpoints
-
- aax: xor bh,bh
- mov bl,[ds:si]
- shl bx,1
-
- add bx,bp
- mov ax,[ds:4*points+bx]
-
- xor bh,bh
- mov bl,[ds:si+1]
- shl bx,1
-
- add bx,bp
- add ax,[ds:4*points+bx]
-
- xor bh,bh
- mov bl,[ds:si+2]
- shl bx,1
-
- add bx,bp
- add ax,[ds:4*points+bx]
-
- mov [ds:di],ax
-
- add di,2
- add si,4
-
- dec cx
- jnz aax
-
-
-
-
-
- xchange_frames: xor bp,bp
- mov di,bp
-
- mov cx,frames
-
- aax3: mov si,bp
-
- mov [ds:countx],0
-
- shl si,1
- mov ax,[ds:z_positions+si]
- shr si,1
-
- mov dx,bp
-
- aax1: inc si
-
- cmp si,cx
- jae aax2
-
- shl si,1
- mov bx,[ds:z_positions+si]
- shr si,1
-
- cmp ax,bx
- jle aax1
-
- inc [ds:countx]
-
- jmp aax1
-
- mov ax,0003h
- int 10h
- mov ax,4c00h
- int 21h
-
-
- jmp aax1
-
- aax2: mov di,frames
- mov di,[ds:countx]
- mov [ds:pots+bp],di
-
- mov si,dx
-
- shl di,2
-
- shl si,2
-
- mov eax,[dword ds:frame+si]
- mov [dword ds:xframe+di],eax
-
- inc bp
- dec cx
- jnz aax3
-
- ret
-
-
-
-
-
- ends coding
-
- segment data1
-
-
- color db 0
-
- countx dw 0
-
- ssizex equ 320
- ssizey equ 400
-
- t_x1 dw 0
- t_y1 dw 0
- t_x2 dw 0
- t_y2 dw 0
- t_x3 dw 0
- t_y3 dw 0
-
- buffer dw 1000 dup(0)
-
- ;
- ; OBJEKT DATEN
- ;
-
- xpos dw 500,500,-500
- dw 500,500,-500
-
- ypos dw 500,-500,000
- dw 500,-500,500
-
- zpos dw -500,-500,-500
- dw 500,500,500
-
- ;
- ; BINDUNGSLISTE FÜR DIE OBJEKT-PUNKTE
- ;
-
- lines db 2,0
- db 2,3
- db 0,3
-
- ;
- ; FLÄCHENLISTE FÜR FÜLLROUTINE
- ;
- db "ESCAPE"
-
- frame db 0,1,2,01h
-
- db 3,4,5,02h
-
- db 255,255,255,255,255,255,255,255
-
- xframe db frames*4 dup (0)
-
- db 255,255,255,255,255,255,255,255
-
- z_positions dw frames dup (0)
-
- db 255,255,255,255,255,255,255,255
-
- pots dw 10 dup (0)
-
- ;
- ; DISTANZ VOM AUGE DES BETRACHTERS IN DEN 3D-RAUM
- ;
-
- dist dw 2000
-
- ;
- ; SINUSTABELLE MIT 128 WERTEN
- ;
-
- sinustable dw 0000h,0192h,0324h,04b5h,0646h
- dw 07d6h,0964h,0af1h,0c7ch,0e06h,0f8dh
- dw 1112h,1294h,1413h,1590h,1709h,187eh
- dw 19efh,1b5dh,1cc6h,1e2bh,1f8ch,20e7h
- dw 223dh,238eh,24dah,2620h,2760h,289ah
- dw 29ceh,2afbh,2c21h,2d41h,2e5ah,2f6ch
- dw 3076h,3179h,3274h,3368h,3453h,3537h
- dw 3612h,36e5h,37b0h,3871h,392bh,39dbh
- dw 3a82h,3b21h,3bb6h,3c42h,3cc5h,3d3fh
- dw 3dafh,3e15h,3e72h,3ec5h,3f0fh,3f4fh
- dw 3f85h,3fb1h,3fd4h,3fech,3ffbh,4000h
- dw 3ffbh,3fech,3fd4h,3fb1h,3f85h,3f4fh
- dw 3f0fh,3ec5h,3e72h,3e15h,3dafh,3d3fh
- dw 3cc5h,3c42h,3bb6h,3b21h,3a82h,39dbh
- dw 392bh,3871h,37b0h,36e5h,3612h,3537h
- dw 3453h,3368h,3274h,3179h,3076h,2f6ch
- dw 2e5ah,2d41h,2c21h,2afbh,29ceh,289ah
- dw 2760h,2620h,24dah,238eh,223dh,20e7h
- dw 1f8ch,1e2bh,1cc6h,1b5dh,19efh,187eh
- dw 1709h,1590h,1413h,1294h,1112h,0f8dh
- dw 0e06h,0c7ch,0af1h,0964h,07d6h,0646h
- dw 04b5h,0324h,0192h
-
- ;
- ; LINIEN-PUNKTE FÜR draw_obj-ROUTINE
- ;
-
- x1 dw 0
- x2 dw 0
- y1 dw 0
- y2 dw 0
-
- ;
- ; ECK-PUNKTE FÜR fill_frame-ROUTINE
- ;
-
- xf1 dw 0
- xf2 dw 0
- yf1 dw 0
- yf2 dw 0
-
- ;
- ; WINKEL FÜR DIE DREHUNGEN IN X,Y UND Z-RICHTUNG
- ;
-
- xw dw 0
- yw dw 0
- zw dw 0
-
- ;
- ; PUNKTE FÜR FÜLLROUTINE
- ;
-
- f_x1 dw 0
- f_y1 dw 0
- f_x2 dw 0
- f_y2 dw 0
- f_x3 dw 0
- f_y3 dw 0
-
- ;
- ; PUFFER FÜR ROTIERTE 3D-KOORDINATEN
- ;
-
- _3dpoints dw 3*points DUP (1) ; gedrehte Koord.
-
- ;
- ; PUFFER FÜR UMGERECHNETE 2D-KOORDINATEN
- ;
-
- _2dpoints dw 2*points DUP (1) ; 2D-Koordinaten
-
- ;
- ; PUFFER FÜR ALTE 2D-KOORDINATEN
- ;
-
- old2d dw 2*points dup (0) ; Alte 2D-Koordinaten
-
- ;
- ; PUFFER FÜR FÜLLKOORDINATEN
- ;
-
- buffer_pos dw 0
- buffer_count dw 0
-
- fill_buf dw 1000 dup (?)
-
-
- ;
- ; 2D-POINTER FÜR POSITIONIERUNG AUF BILDSCHIRM
- ;
-
- x_add dw 160
- y_add dw 100
-
- ;
- ; FARBDATEN FÜR DIE GLASFLÄCHEN
- ;
-
- colorpal db 00,00,00
- db 00,00,50
- db 00,00,50
- db 00,00,40
-
-
- ends data1
-
- end start
-
- mov ax,[ds:x1]
- cmp ax,[ds:x2]
- jz no_xadd
- jmp draw_it
-
- no_xadd:
-
- mov ax,[ds:y1]
- cmp ax,[ds:y2]
- jnz draw_it
-
- mov ax,[ds:x1]
- mov bx,[ds:y1]
- jmp stop_line
-